<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import=" vn.edu.ptithcm.helper.CKEditorConfigHelper" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
<c:choose>
	<c:when test="${bean.cmd == 'add' }">
	   <spring:message  code="pim"/> - <spring:message  code="add.document"/>
	</c:when>
	<c:otherwise>
	   <spring:message  code="pim"/> - <spring:message  code="edit.document"/> - <c:out value="${resource.title}"></c:out>
	</c:otherwise>
</c:choose>
</title>
<link href="<%= request.getContextPath() %>/css/custom.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/v.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/uploadify.css" rel="stylesheet" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-ui-1.8.14.custom.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.uploadify.v2.1.4.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/swfobject.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/AC_OETags.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.hint.text.js"></script>
<%@include file="script/pim-util.jsp" %>
<%@include file="script/document-script.jsp" %>
</head>
<body>
<c:if test="${bean.isSigned && bean.isAdmin}">
<div id="all">
<div id="wrapper">
<div id="mainheader">
	<jsp:include page="include/common/headerSignedIn.jsp" />
</div> 
<div id="content-wrapper">
<div id="top-menu">
    <jsp:include page="include/common/topMenuHome.jsp" /> 
</div>
<div class="main-content">
<form:form action="" method="post" commandName="resource" name="handleDocument">	   		  
<div>	
	<div class="v-row v-border-bottom" style="padding-top: 10px;">
		<div class="v-row-left" style="margin-left: 10px;">
			<span class="v-title">
			  	<c:choose>
					<c:when test="${bean.cmd == 'add' }">
					  <spring:message  code="add.document"/>
					</c:when>
					<c:otherwise>
					   <spring:message  code="edit.document"/>
					</c:otherwise>
				</c:choose>		  	
			</span>
		</div>
		<c:set value="members.htm?pnum=${bean.project.number}&tab=listMembers" var="url"/>  
		<div style="float: right;">
			<a href='<c:out value="${url}" />' style="padding-right: 10px;color: blue;text-decoration:none;"> 
				[<spring:message code="back.to.project.homepage" />]</a>
		</div>	
	</div>	
	<div class="v-row" id="v-global-message"></div>		
	<div class="v-body">	
	<div style="margin-left: 40px;">
		<div class="v-row">
			<div class="v-row-left">
				<span class="v-required-title">
				    <spring:message code="title.required.field" />
				</span>
			</div>
		</div>	
		
		<div class="v-row">
			<div class="v-row-right eighty">
				<span>
			     	<input name="fileUploads" id="fileUploads" type="file" size="50" />
				</span>
			</div>								
		</div>		
		<div id="nosupportFlash" class="v-row" style="display: none;">
            <h4>Your browser don't support to the flash now! Please choose the other browser.</h4>
        </div> 
        
		<div class="v-row">
			<div class="v-row-left">
				<span>
				    <spring:message code="document.category" />
				</span>
			</div>			
			<div class="v-row-right eighty">			    
				  <span>
                     <form:select path="categoryId" cssClass="v-select">                        
                        <form:options items="${bean.categories}" itemLabel="name" itemValue="id"/>                       
                     </form:select>				    
				 </span>				 							
			</div>
		</div>		
		
		<div class="v-row">
			<div class="v-row-left">
				<span>
			     	<spring:message code="required.document.title" />
				</span>
			</div>			
			<div class="v-row-right eighty">
			    <div>
				<span>
				    <form:input path="title" maxlength="200" cssClass="v-input"/>		
				 </span>		
				 </div>
			</div>
		</div>			
		 
		 <div class="v-row">
			<div class="v-row-left">
				<span>
			     	<spring:message code="document.description" />
				</span>
			</div>			
			<div class="v-row-right eighty">			   
				<span>
				    <form:textarea cols="78" rows="8" path="description" cssClass="description"/>		
				 </span>				 			
			</div>
		</div>		
		        				
		<div class="v-row">
		    <br/>
			<div class="v-row-center">
				<span>
				<input type="button" onclick="startUpload('fileUploads');" class="bt-form" 
				       value="<spring:message code="button.save" />"/>
				</span>				
				<span>
				<input type="button" class="bt-form"
						onclick="cancel('<c:out value='${bean.returnToFullPageURL }'/>')"
						value="<spring:message code="button.cancel"/>" />
				</span>
			</div>
		</div>
	</div>
    </div>
</div>
<input type="hidden" name="fileInfo"/>
<input type="hidden" name="cmd" value="${bean.cmd}"/>
<input type="hidden" name="returnToFullPageURL" value="${bean.returnToFullPageURL}"/>
<input type="hidden" name="pnum" value="${bean.project.number}"/>
</form:form>	 	
</div>	
</div>
</div>
<div class="footer">
	<jsp:include page="include/common/footer.jsp" />
</div>
</div>	
<ckeditor:replace basePath="/ckeditor/" replace="description" config="<%= CKEditorConfigHelper.createConfig(725) %>"/>		   
</c:if>
</body>
</html>	